package part12;

/**
 * @author wcj
 * @Date 2021/5/21 17:01
 * @Version 1.0
 */
public class Part1212 extends Inning implements Storm {

    public Part1212() throws RainedOut, AllBaseException {
    }

    public Part1212(String s) throws Foul, AllBaseException {
    }

    /**
     * 不能抛出异常，因为这个类继承自基类，而基类中这个方法没有抛出异常
     */
//    @Override
//    public void walk() throws PopFoul{
//        super.walk();
//    }

    @Override
    public void atBat(){

    }

    @Override
    public void rainHard() throws RainedOut {

    }

    /**
     * 不能抛出异常,因为基类和接口中都有该方法，如果抛出异常，无法确定抛出异常的类型
     */
    @Override
    public void event() {
    }
}

class AllBaseException extends Exception {
}

class Foul extends AllBaseException {
}

class Strike extends AllBaseException {
}

abstract class Inning {
    public Inning() throws AllBaseException {
    }

    public void event() throws AllBaseException {
    }

    /**
     * atBat
     */
    public abstract void atBat();

    public void walk() {
    }
}

class StormException extends Exception {
}

class RainedOut extends StormException {
}

class PopFoul extends StormException {
}

interface Storm {
    /**
     * event
     *
     * @throws RainedOut
     */
    public void event() throws RainedOut;

    /**
     * rainHard
     *
     * @throws RainedOut
     */
    public void rainHard() throws RainedOut;
}

